<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%-- 
    Document   : labtask
    Created on : 05.05.2010, 10:56:59
    Author     : Cyclone
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <script type="text/javascript" src="JS/jquery.js"></script>
        <script type="text/javascript" src="JS/labtask.js"></script>

        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <link rel="stylesheet" type="text/css" href="css/theme.css" />

        <title>Настройка проверки практической работы</title>
    </head>
    <body>



        <h1>Настройка проверки практической работы №${labNumber}</h1>
        <c:if test="${labNumber != 1}">
            <a href="LabTask?courseId=${courseId}&labNumber=${labNumber-1}" title="Предыдущая работа">
                <img src="img/icons/arrow_left.gif" alt="<-"/>
            </a>
        </c:if>
        <a href="LabTask?courseId=${courseId}&labNumber=${labNumber+1}" title="Следующая работа">
            <img src="img/icons/arrow_right.gif" alt="->"/>
        </a>
        
        <div id="box" style="margin: 5px;">
            <div id="checkContainer">

                <!-- dummy div[name=coContainer] -->
                <div name="coContainer" style="display: none" class="newContainer">
                    <input type="hidden" value="'%TEMP_ID%'" name="tempId" />
                    <div id="rightnow">
                        <h3 class="reallynow">
                            <span id="coSpan_'%TEMP_ID%'"></span>
                            <a class="close" onclick="delObject(event)">Удалить</a>
                            <br/>
                        </h3>
                    </div>
                    <div id="coDiv_'%TEMP_ID%'">
                        <form id="form">
                            <input type="hidden" name="id" value="'%TEMP_ID%'"/>
                            <label for="path">
                                Путь :
                            </label>
                            <textarea class="input" name="path" onchange="pathChanged(event)"></textarea>
                            <%-- <input type="text" name="path" onchange="pathChanged('%TEMP_ID%')" style="width: 40%;" /> --%>

                            <br/>
                            <label for="type">
                                Тип :
                            </label>
                            <c:choose>
                                <c:when test="${!empty coTypeList}">
                                    <select name="type">
                                        <c:forEach items="${coTypeList}" var="cot">
                                            <option value="${cot.id}">${cot.objectType}</option>
                                        </c:forEach>
                                    </select>
                                </c:when><c:otherwise>
                                    <input type="text" value="${co.type}" name="type" />
                                </c:otherwise>
                            </c:choose>

                            <br/>
                            <p style="font-weight: bold">Содержимое</p>
                            <div class="content">

                                <!-- dummy div -->
                                <div name="combDiv" style="display: none;">
                                    <textarea style="height: 30px;" onkeyup="expandTextArea(event)" onclick="expandTextArea(event)" name="taComb"></textarea>
                                    <input type="button" value="X" onclick="deleteComb(event);" style="margin: 0px; padding-bottom: 0px; padding-top: 0px;" title="Удалить комбинацию"/>
                                    <br/>
                                </div>
                                <span class="noCheck">
                                    Содержимое не проверяется
                                </span>
                            </div>
                            <input type="button" value="Добавить комбинацию" onclick="addCombination(event)"/>
                        </form>
                    </div>
                </div>


                <c:forEach items="${checkObjectList}" var="co">
                    <div name="coContainer">
                        <div id="rightnow">
                            <!-- <h3 class="reallynow"  style="background-color: #5D99A3"> -->
                            <h3 class="reallynow">
                                <span id="coSpan_${co.id}"><c:out value="${co.path}" escapeXml="true" /></span>
                                <a class="close" onclick="delObject(event)">Удалить</a>
                                <br/>
                            </h3>
                        </div>
                        <div id="coDiv_${co.id}">
                            <form id="form">
                                <input type="hidden" name="id" value="${co.id}"/>
                                <label for="path">
                                    Путь :
                                </label>
                                <textarea class="input" name="path" onchange="pathChanged(event)">${co.path}</textarea>

                                <br/>
                                <label for="type">
                                    Тип :
                                </label>
                                <c:choose>
                                    <c:when test="${!empty coTypeList}">
                                        <select name="type">
                                            <c:forEach items="${coTypeList}" var="cot">
                                                <c:choose>
                                                    <c:when test="${co.type == cot.id}">
                                                        <option value="${cot.id}" selected="selected">${cot.objectType}</option>
                                                    </c:when>
                                                    <c:otherwise>
                                                        <option value="${cot.id}">${cot.objectType}</option>
                                                    </c:otherwise>
                                                </c:choose>
                                            </c:forEach>
                                        </select>
                                    </c:when><c:otherwise>
                                        <input type="text" value="${co.type}" name="type" />
                                    </c:otherwise>
                                </c:choose>

                                <br/>
                                <p style="font-weight: bold">Содержимое</p>
                                <div class="content">

                                    <!-- dummy div -->
                                    <div name="combDiv" style="display: none;">
                                        <textarea style="height: 30px;" onkeyup="expandTextArea(event)" onclick="expandTextArea(event)" name="taComb"></textarea>
                                        <input type="button" value="X" onclick="deleteComb(event);" style="margin: 0px; padding-bottom: 0px; padding-top: 0px;" title="Удалить комбинацию"/>
                                        <br/>
                                    </div>

                                    <c:choose>
                                        <c:when test="${!empty co.content}">
                                            <c:forEach items="${co.content}" var="comb">
                                                <div name="combDiv">
                                                    <textarea style="height: 30px;" onkeyup="expandTextArea(event)" onclick="expandTextArea(event)" name="taComb"><c:out value="${comb}" escapeXml="true" /></textarea>
                                                    <input type="button" value="X" onclick="deleteComb(event);" style="margin: 0px; padding-bottom: 0px; padding-top: 0px;" title="Удалить комбинацию"/>
                                                    <br/>
                                                </div>
                                            </c:forEach>
                                        </c:when><c:otherwise>
                                            <span class="noCheck">
                                                Содержимое не проверяется
                                            </span>
                                        </c:otherwise>
                                    </c:choose>
                                </div>



                                <input type="button" value="Добавить комбинацию" onclick="addCombination(event)"/>

                            </form>

                        </div>
                    </div>
                </c:forEach>
                <input type="hidden" value="${courseId}" id="courseId"/>
                <input type="hidden" value="${labNumber}" id="labNumber"/>

            </div>
            <form id="form">
                <input type="button" value="Добавить объект" onclick="addObject()"/>
                <input type="button" value="Сохранить изменения" onclick="saveConfig();"/>
            </form>

            <div id="task" style="display: none;
                 position: fixed;
                 right: 5px;
                 top: 36px;
                 border: 1px gray dotted;
                 width: 24%;
                 padding: 5px;
                 background-color: white;
                 overflow-y: scroll;">
            </div>

            <input id="showDescBtn" style="position: absolute; right: 5px; top: 2px;" type="button" value="Запросить описание" onclick="showDescription(${courseId}, ${labNumber})"/>
            <input id="hideDescBtn" style="position: absolute; right: 5px; top: 2px; display: none" type="button" value="Скрыть описание" onclick="hideDescription()"/>
        </div>
    </body>
</html>
